/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.rpc.simright.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "simright.request.config")
public class SimrightRequestConfig {
    private String protocol;
    private String host;
    private Integer port;
    private String path;

    /**
     * 拼接一下请求路径前缀
     */
    public String getPreUrl() {
        if (port == null) {
            return String.format("%s://%s/%s", protocol, host, path);
        }
        return String.format("%s://%s:%d/%s", protocol, host, port, path);
    }
}

